package com.huike.data.controller;

import com.huike.data.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class TestController2 {
    //TestService 的初始化是由spring Ioc进行的初始化的 原理是啥

    @Autowired  //是自动累加的
    private TestService testService;


    @RequestMapping(value = "test2" ,method = RequestMethod.GET)
    @ResponseBody  //返回字符串
    public Map<String, Object> getData(){
        Map<String,Object> map = new HashMap<>(16);//java技术为啥要指定一个值
        testService.getDataTest(6);
        map.put("code",0);
        System.out.println("代码在这");
        map.put("msg","这");
        return map;
    }

}
